package top.blackr.folivora.common.pay.refund;


import jakarta.servlet.http.HttpServletRequest;
import top.blackr.folivora.common.pay.refund.entity.RefundInformation;

import java.io.IOException;
import java.util.function.Consumer;

/**
 * 退款接口
 */
public interface RefundStrategy<I extends RefundInformation> {

    /**
     * 生成三方支付退款请求相关数据
     */
    default void generateRefundParams() {}

    /**
     * 订单退款支付回调
     */
    default void noticeCallback(HttpServletRequest request) throws IOException {}

    /**
     * 订单退款支付回调
     */
    default void noticeCallback(HttpServletRequest request, Consumer<String> consumer) throws IOException {}

    /**
     * 退款
     */
    default void refund(I refundInformation) {}

    /**
     * 记录支付信息：流水、退款时间等
     */
    default void recordInformation() {}

    /**
     * 其他可异步的操作：短信、通知等
     */
    default void asyncAppendage() {}
}
